package com.asiainfo.validator;

import java.util.Arrays;
import java.util.List;

/**
 * Created by fankp on 16/8/10.
 */
public class ValidatorCard {

    public static boolean validaterCard(int memberId, String cardType, int cardTimes){
        boolean isOk = true;
        if (memberId == -1){
            isOk =false;
            System.out.println("用户ID有误。增加会员卡失败");
        }
        String cardTypes[] = new String[]{"Y","T"}; //Y:年卡
        List<String>  cardTypeList = Arrays.asList(cardTypes);
        if (!cardTypeList.contains(cardType)){
            isOk =false;
            System.out.println("卡类型有误,增加会员卡失败。");
        }
        if ((cardTimes+"").length()>5){
            isOk =false;
            System.out.println("卡次数有误,增加会员卡失败。");
        }
        return isOk;
    }
}
